<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
    <head> 
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <%@ include file="/WEB-INF/views/include/head.jsp"%>
    <link rel="stylesheet" href="${ctxStatic}/css/common_erp.css">
    <link rel="stylesheet" href="${ctxStatic}/css/list.css">
    <script src="${ctxStatic}/js/jquery-1.9.1.min.js"></script>
    <script src="${ctxStatic}/js/DateTimePicker.js"></script>
    <script src="${ctxStatic}/js/layer.js"></script>
    <script src="${ctxStatic}/js/style.js"></script>
    <script src="${ctxStatic}/dateCalendar/WdatePicker.js"></script>
    <script>
	// 检索方法
	function searchListForm() {
		var params = $("#searchForm").serialize();
		$("#activity_pane").showLoading();
		$.post("${ctx}/specimen/production/searchList",params,function(result) {
					var listHtml = result["specimenProduction"];
					var pageHtml = result["page"];
					$("#listHtml").html(listHtml);
					$("#paging").html(pageHtml);
					thumbnail();
					$("#activity_pane").hideLoading();
				}, 'json');
	}
	
	$(function(){
			$("#sampleUserId").select2();
		    searchListForm();
            $(".tabBox ul li").each(function(){
                var index=$(this).index();

                $(".tabBox ul li").eq(0).addClass("active");

                $(this).click(function(){

                    $(this).addClass("active").siblings().removeClass("active");
                    
                    $("#tabPageStatus").val($(this).val());
                    searchListForm();

                    $(".tabBoxSm > .tabSm").eq(index).stop(true).show().siblings().stop(true).hide();
					
					var tableW = $(".tabBoxSm > .tabSm").eq(index).find('.tableHead').width();
					var tabodyH = $(".tabBoxSm > .tabSm").eq(index).find('.tableBody').height();
					var tableScrollH = $(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').height();
					if(tabodyH>tableScrollH){
						$(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').css('width',tableW + 18 + 'px')
					}else{
						$(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').css('width','inherit')
					}

                })

            })

        })
        
    // 重置方法
	function clearParam() {
		$("#sampleRequestNo").val("");
		$("#styleNo").val("");
		$("#styleNameCn").val("");
		$("#dateFrom").val("");
		$("#dateTo").val("");
		$("#userId").val("");
		$("#sampleUserId").val("");
		$("#sampleUserId").select2();
		searchListForm();
	}
	
    $(document).keydown(function(event){
    	if(event.keyCode == 13){
    		searchListForm();
    	}
    }); 
    
	function toCreateImage(index) {
		var styleID = $("#listHtml").find(".styleID").eq(index).val();
		var styleTemp = $("#listHtml").find(".styleTemp").eq(index).val();
		var uploadFile = $("#listHtml").find(".uploadFile").eq(index).val();
		var sampleRequestId = $("#listHtml").find(".sampleId").eq(index).val();
		var selectCode = styleTemp.split("-");
		var url = "?styleID="+styleID+"&styleTemp="+styleTemp+"&uploadFile="+uploadFile+"&sampleRequestId="+sampleRequestId+"&popupCategoryCd="+(selectCode[1]+"_FIT_ITEM")+"&otherImageFlg=specimenProduction";
		popup('1000px','600px','${ctx}/specimen/demand/createStyle'+url);
	}
    </script>
</head>
<body>
<form id="searchForm" method="post">
<div class="listArea" id="activity_pane">
	<div class="listBg">
        <div class="searchArea clearfix">
            <div class="searchLeft clearfix">
                <div class="searchInp clearfix">
                    <p class="tit"><spring:message code="specimenProduct_sampleRequestNo" /></p>
                    <input type="text" class="w-styleNub" id="sampleRequestNo" name="sampleRequestNo">
                </div>
                <div class="searchInp clearfix">
                    <p><spring:message code="specimenProduct_styleNo" /></p>
                    <input type="text" class="w-customer" id=styleNo name="styleNo">
                </div>
                <div class="searchInp clearfix">
                    <p><spring:message code="specimenProduct_styleNameCn" /></p>
                    <input type="text" class="w-customer" id="styleNameCn" name="styleNameCn">
                </div>
                <div class="searchInp clearfix">
                    <p><spring:message code="specimenProduct_date" /></p>
                    <div class="timeBox">
                        <input type="text" class="laydate-icon" id="dateFrom" name="dateFrom" style="width: 110px" onclick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd',onpicked:null})">
						<p class="list">~</p>
						<input type="text" class="laydate-icon" id="dateTo" name="dateTo" style="width: 110px" onclick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd',onpicked:null})">
                    </div>        
                </div>
                <div class="searchInp clearfix">
                    <p><spring:message code="specimenProduct_sampleUser" /></p>
                    <select id="sampleUserId" name="sampleUserId" style="width: 100px;">
                    	<option value="">请选择</option>
                    	<c:forEach items="${sampleUserList }" var="user">
                    		<option value="${user.id }">${user.comUserName }</option>
                    	</c:forEach>
                    </select>
                </div>
                <!-- 
                <div class="searchInp clearfix">
                    <p><spring:message code="specimenProduct_salesman" /></p>
                    <input type="text" class="w-salesman" id="userId" name="userId">
                </div>
                 -->
            </div>
            <div class="searchRight clearfix">
                <button type="button" onclick="searchListForm();"><spring:message code="commom_check"/></button>
                <button type="button" onclick = "clearParam()"><spring:message code="common_reset" /></button>
            </div>
        </div>
    </div>
    
    <input type="hidden" id="tabPageStatus" name="tabPageStatus" value="0"/>
    <div class="tabBox">
        <ul class="clearfix">
            <li class="active" value="0"><spring:message code="specimenProduct_status_all" /></li>
            <li value="1"><spring:message code="specimenProduct_status_wait_template" /></li>
            <li value="2"><spring:message code="specimenProduct_status_wait_sample" /></li>
            <li value="3"><spring:message code="specimenProduct_status_wait_accept" /></li>
            <li value="4"><spring:message code="specimenProduct_status_done" /></li>
        </ul>
	</div>
     <div class="listBg tabPadding overflowX">
        <div class="tableArea">
            <div class="tableScrollSm" style="overflow: auto;width: 1755px;height: 660px;">
                <table cellpadding="0" class="tableHead">
                    <thead>
                    <tr>
                        <th><p class="tab-No"><spring:message code="specimenProduct_head_no" /></p></th>
                        <th><p class="width-180px"><spring:message code="specimenProduct_head_sampleRequestNo" /></p></th>
                        <th><P class="width-80px"><spring:message code="specimenProduct_head_stylePictures" /></P></th>
                        <th><p class="width-200px"><spring:message code="specimenProduct_head_no_name" /></p></th>
                        <th><p class="width-100px"><spring:message code="specimenProduct_head_styleCategory" /></p></th>
                        <th><p class="width-100px"><spring:message code="specimenProduct_head_sampleType" /></p></th>
                        <th><p class="width-80px"><spring:message code="specimenProduct_head_sampleSize" /></p></th>
                        <th><p class="width-100px"><spring:message code="specimenProduct_head_samplePlanDueDate" /></p></th>
                        <th><p class="width-100px"><spring:message code="specimenProduct_head_sampleaAtualEndDate" /></p></th>
                        <th><P class="width-80px"><spring:message code="specimenProduct_head_num" /></P></th>
                        <th><P class="width-80px"><spring:message code="specimenProduct_head_reworkNum" /></P></th>
                        <th><p class="width-100px"><spring:message code="specimenProduct_head_sampleCost" /></p></th>
                        <th><P class="width-100px"><spring:message code="specimenProduct_head_template_end_date" /></P></th>
                        <th><p class="width-100px"><spring:message code="specimenProduct_head_make_id" /></p></th>
                        <th><P class="width-100px"><spring:message code="specimenProduct_head_sample_end_date" /></P></th>
                        <th><p class="width-100px"><spring:message code="specimenProduct_head_sam_id" /></p></th>
                        <th><p class="width-80px"><spring:message code="specimenProduct_head_set" /></p></th>
                    </tr>
                    </thead>
                </table>
                <table cellpadding="0" class="tableBody">
					<tbody id="listHtml">
					</tbody>
                </table>
            </div>
    </div>
    </div>
    <div id="paging"></div>
</div>
</form>
</body>
</html>